package com.lg.baselibrary.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class SharePreferenceUtil
{
    private static String DEFAULT_PREF_FILE_NAME = "cache";
    private static SharedPreferences sharedPreferences;

    public static String get(Context paramContext, String paramString)
    {
        if (sharedPreferences == null) {
            sharedPreferences = paramContext.getSharedPreferences(DEFAULT_PREF_FILE_NAME, 0);
        }
        return sharedPreferences.getString(paramString, "");
    }

    public static Boolean getBoolean(Context paramContext, String paramString, boolean paramBoolean)
    {
        if (sharedPreferences == null) {
            sharedPreferences = paramContext.getSharedPreferences(DEFAULT_PREF_FILE_NAME, 0);
        }
        return Boolean.valueOf(sharedPreferences.getBoolean(paramString, paramBoolean));
    }

    public static int getInt(Context paramContext, String paramString, int paramInt)
    {
        if (sharedPreferences == null) {
            sharedPreferences = paramContext.getSharedPreferences(DEFAULT_PREF_FILE_NAME, 0);
        }
        return sharedPreferences.getInt(paramString, paramInt);
    }

    public static long getLong(Context paramContext, String paramString, long paramLong)
    {
        if (sharedPreferences == null) {
            sharedPreferences = paramContext.getSharedPreferences(DEFAULT_PREF_FILE_NAME, 0);
        }
        return sharedPreferences.getLong(paramString, paramLong);
    }

    public static void put(Context paramContext, String paramString, int paramInt)
    {
        if (sharedPreferences == null) {
            sharedPreferences = paramContext.getSharedPreferences(DEFAULT_PREF_FILE_NAME, 0);
        }
        sharedPreferences.edit().putInt(paramString, paramInt).apply();
    }

    public static void put(Context paramContext, String paramString, long paramLong)
    {
        if (sharedPreferences == null) {
            sharedPreferences = paramContext.getSharedPreferences(DEFAULT_PREF_FILE_NAME, 0);
        }
        sharedPreferences.edit().putLong(paramString, paramLong).apply();
    }

    public static void put(Context paramContext, String paramString1, String paramString2)
    {
        if (sharedPreferences == null) {
            sharedPreferences = paramContext.getSharedPreferences(DEFAULT_PREF_FILE_NAME, 0);
        }
        sharedPreferences.edit().putString(paramString1, paramString2).apply();
    }

    public static void put(Context paramContext, String paramString, boolean paramBoolean)
    {
        if (sharedPreferences == null) {
            sharedPreferences = paramContext.getSharedPreferences(DEFAULT_PREF_FILE_NAME, 0);
        }
        sharedPreferences.edit().putBoolean(paramString, paramBoolean).apply();
    }

    public static void remove(Context paramContext, String paramString)
    {
        if (sharedPreferences == null) {
            sharedPreferences = paramContext.getSharedPreferences(DEFAULT_PREF_FILE_NAME, 0);
        }
        sharedPreferences.edit().remove(paramString).apply();
    }
}
